import Vue from 'vue';
import moment from 'moment';

Vue.filter('fixed', (val, num = 2) => {
	if (val) {
		return val.toFixed(num);
	} else {
		return 0;
	}
});

Vue.filter('format_date', (val, format = 'YYYY-MM-DD HH:mm:ss') => {
	if (val) {
		return moment(val).format(format);
	} else {
		return '';
	}
});
